# 导包
import requests
import config

# 创建接口化类
class CourseAPI:
    #初始化
    def __init__(self):
        self.url_insert = config.BASE_URL + "/api/clues/course"
        self.url_select = config.BASE_URL + "/api/clues/course/list"
        self.url_update = config.BASE_URL + "/api/clues/course"
        self.url_delete = config.BASE_URL + "/api/clues/course/{}"

    # 新增课程
    def inset_course(self,token666,insert_data):
        return requests.post(url=self.url_insert,headers={"Authorization":token666}, json=insert_data)
    # 查询课程
    def select_course(self,token666):
        return requests.get(url=self.url_select,headers={"Authorization":token666})
    # 修改课程
    def update_course(self,token666,update_data):
        return requests.put(url=self.url_update,headers={"Authorization":token666},json=update_data)
    # 删除课程
    def delete_course(self,token666,course_id):
        return requests.delete(url=self.url_delete.format(course_id),headers={"Authorization":token666})